package demo.list;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Stack;
import java.util.Vector;


public class MyArrayList {

	public static void main(String[] args) {
        //List  -- ArrayList, LinkedList, Vector 
		List list=new ArrayList(20); //replacement of array. //it also works on index based  //duplicates allowed. 
		
		list.add("Hello");
		LinkedList linkedList=new LinkedList();
	//	 linkedList.p
		//there no direct method to get any value in Set Interfac where as in List there is. 
		
//	   System.out.println(list.get(2));
		//list.remove(new Object());// remove is matched.. with object. 
		list.add("hello");
		list.add("a");
		///System.out.println("Size before removal:"+list.size());
		//0 to 5 total 6
		//System.out.println("size of removing :"+list.size());
	   Collections.sort(list);
	   System.out.println(list);
	   Collections.sort(list, Collections.reverseOrder());
	   System.out.println(list);
	  // list.
		/*for (int i = 0; i < list.size(); i++) {
			 System.out.println(list.get(i));
			 
			 
		}*/
		
	/*Iterator iterator=	list.iterator();
	while (iterator.hasNext()) {
		Object object = (Object) iterator.next();
		
		if(object instanceof String){
			System.out.println((String)object);
		}else if(object instanceof Integer) {
			System.out.println("Integer found " +(Integer)object);
			if(12==(Integer)object){
				System.out.println("object removed.");
				iterator.remove();
			}
		}
	}
		System.out.println(list);
       		

	ListIterator listIterator=   list.listIterator();

	  while (listIterator.hasNext()) {
		Object object = (Object) listIterator.next();
	}
	
	  
	  while(listIterator.hasPrevious()){
		  System.out.println("has prev................................");
		  Object object=(Object)listIterator.previous();
	  }
	
	  while(listIterator.hasPrevious()){
		  System.out.println("has prev..");
		  Object object=(Object)listIterator.previous();
	  }
     System.out.println("hello".length());	  
	  System.out.println(list.size());
	  System.out.println(list.toArray().length);*/
	    

	}
}
